//
//  XkxSportMainController.m
//  侠客行
//
//  Created by laibingqiang on 16/11/8.
//  Copyright © 2016年 laibingqiang. All rights reserved.
//

#import "XkxSportMainController.h"
#import <Masonry.h>
#import "UILabel+addition.h"
#import "UIButton+addition.h"
#import "SportsModel.h"
#import "XkxSportViewController.h"
@interface XkxSportMainController ()

@property(nonatomic,weak) UILabel *tipLabel;

@property(nonatomic,weak) UIButton *runBtn;

@property(nonatomic,weak) UIButton *walkBtn;

@property(nonatomic,weak) UIButton *bikeBtn;
@end

@implementation XkxSportMainController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
}

- (void)btnClink:(UIButton *)sender
{
    XkxSportViewController *VC = [[XkxSportViewController alloc] init];
    
    VC.type = sender.tag;
    
    [self presentViewController:VC animated:YES completion:nil];
}

- (void)setupUI
{
    self.view.backgroundColor = [UIColor whiteColor];
    
    UILabel *tipLable = [[UILabel alloc] initWithText:@"您这次跑了3000里" font:[UIFont systemFontOfSize:20] textColor:[UIColor redColor]];
    
    [self.view addSubview:tipLable];
    
    self.tipLabel = tipLable;
    
    [tipLable mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.view);
        
        make.centerY.equalTo(self.view).offset(-200);
    }];
    
    
    UIButton *runBtn = [[UIButton alloc] initWithText:@"我要跑" font:[UIFont systemFontOfSize:16] textColor:[UIColor blueColor]];
    
    runBtn.tag = XkxSportTypeRun;
    [self.view addSubview:runBtn];
    
    self.runBtn = runBtn;
    
    [runBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.view);
        
        make.centerY.equalTo(self.view).offset(100);
    }];
    
    UIButton *walkBtn = [[UIButton alloc] initWithText:@"我要走" font:[UIFont systemFontOfSize:16] textColor:[UIColor blueColor]];
    
    walkBtn.tag = XkxSportTypeWalk;
    [self.view addSubview:walkBtn];
    
    self.walkBtn = walkBtn;
    
    [walkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(tipLable);
        
        make.centerY.equalTo(self.view).offset(150);
    }];
    
    
    UIButton *bikeBtn = [[UIButton alloc] initWithText:@"我要走" font:[UIFont systemFontOfSize:16] textColor:[UIColor blueColor]];
    
    bikeBtn.tag = XkxSportTypeBike;
    [self.view addSubview:bikeBtn];
    
    self.bikeBtn = bikeBtn;
    
    [bikeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(tipLable);
        
        make.centerY.equalTo(self.view).offset(200);
    }];
    
    [runBtn addTarget:self action:@selector(btnClink:) forControlEvents:UIControlEventTouchUpInside];

     [walkBtn addTarget:self action:@selector(btnClink:) forControlEvents:UIControlEventTouchUpInside];
    
     [bikeBtn addTarget:self action:@selector(btnClink:) forControlEvents:UIControlEventTouchUpInside];
    
}


@end
